<?php
$this->headTitle($this->T('Your Posts'));
$this->placeholder('content_title')->set($this->T('Your Posts'));
//$this->placeholder('body_onload')->set('document.article.focus();');

$flashMessenger = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger')->setNamespace('post');
$Message = implode('<br />', $flashMessenger->getMessages());
$this->placeholder('flash_message')->set($this->E($Message));

?>

<div id="">
    <a href="<?php echo $this->U('post', 'edit'); ?>"><?php echo $this->T('New Post'); ?></a>
</div>

<div id="">

    <br class="clear" />

    <?php 
    if (isset($this->posts) and is_array($this->posts) and !empty($this->posts)) {

        $i = 0;
    ?>
        <div class="post_list">

            <table width="100%" border="0" cellspacing="5" cellpadding="0">

                <tr>
                    <td class="list_head"><?php echo $this->T('No.'); ?></td>
                    <td class="list_head"><?php echo $this->T('Title'); ?></td>
                    <td class="list_head"><?php echo $this->T('Date'); ?></td>
                    <td></td>
                </tr>
    <?php
        foreach ($this->posts as $post) {
            
            $i++;
    ?>
                <tr>
                    <td class="list_content"><?php echo $i; ?></td>
                    <td class="list_content">
                        <a href="<?php echo $this->U('post', 'edit', 'admin', array('id' => $post['post_id'])) ?>">
                            <?php echo $this->E($post['post_title']); ?>
                        </a>
                    </td>
                    <td class="list_content"><?php echo $this->E($post['post_date_create']); ?></td>
                    <td class="list_content post_delete">
                        <a href="<?php echo $this->U('post', 'delete', 'admin', array('id' => $post['post_id'])); ?>" onclick="return confirm('<?php echo $this->T('Do you really want to delete this post ?'); ?>');">
                            <img src="<?php echo $this->pathImages; ?>/icons/cross_red.ico" />
                        </a>
                    </td>
                </tr>

    <?php
        }
    ?>
            </table>
        </div>
    <?php
    }
    ?>

</div>